Page({
  data: {
    garBageList: [],
    desc: "",
    groupName: "",
    logoUrl: "",
  },
  onLoad(query) {
    const { groupName } = query;
    let that = this;
    this.setData({
      groupName,
    });
    my.showLoading();
    Promise.all([
      my.functionContext.callFunction({
        name: "getGarbageInfo",
        data: {
          groupName,
        },
      }),
      my.functionContext.callFunction({
        name: "getGarbageGroupDesc",
        data: {
          groupName,
        },
      }),
    ])
      .then((res) => {
        my.hideLoading();
        if (res[0].result) {
          that.setData({
            garBageList: res[0].result,
          });
        }
        if (res[1].result) {
          that.setData({
            desc: res[1].result.desc,
            logoUrl: res[1].result.logoUrl,
          });
        }
      })
      .catch(() => {
        my.hideLoading();
        my.showToast({
          content: "加载失败，请刷新重试～",
        });
      });
  },
});
